﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Windows.Media;
using System.Linq;
using System.Text;
using System.Windows;
using Contracts;

namespace SampleAddin
{
    [WpfServiceMetadata("SampleAddin")]
    public class SampleAddinImpl : IWpfService
    {
        string _name = "SampleAddin", _status;
        public event EventHandler StatusUpdated;

        SettingsUserControl _optionsUI = new SettingsUserControl();

        public System.Windows.Controls.UserControl OptionsUserControl
        {
            get { return _optionsUI; }
        }

        public string Name
        {
            get { return _name; }
        }

        // http://csharpsimplified.wordpress.com/2009/02/16/resources-in-wpf-i-binary-resources/
        public Uri AddinIconUri
        {
            get
            {
                string path = "pack://application:,,,/SampleAddin;component/Resources/AutoList.png";

                return new Uri( path);
            }
        }

        public string Description
        {
            get { return "This is a test to see how an addin can work"; }
        }

        public string Author
        {
            get{return "Arian T. Kulp";}
        }

        public Version Version
        {
            get { return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; }
        }

        public Uri AuthorUri
        {
            get{return new Uri("http://www.ariankulp.com");}
        }

        public Uri UpdateUri
        {
            get { return new Uri("http://www.ariankulp.com/downloads"); }
        }

        public string Status
        {
            get { return _status; }
            set
            {
                if (value != _status)
                {
                    _status = value;

                    if (StatusUpdated != null)
                        StatusUpdated(this, null);
                }
            }
        }

        public void Initialize()
        {
            _optionsUI.DataContext = this;
        }

        public void Start()
        {
            Status = "Started";
        }

        public void Stop()
        {
            
        }

    }
}
